<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>拖车渠道银行账号</title>
<jsp:include page="../../import.jsp" flush="true" />
<%--<jsp:include page="assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->--%>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <!-- 列表显示块 -->
        <div id="ligergrid_bankacc" class="sq-grid"></div>
        <input name="chnId" id="chnId" type="hidden" value="${chnId}">
    </div>
</div>

<script type="text/javascript">
    var grid = null;
    $(function () {
        initEvent();
        initGrid();
    });

    //初始化事件
    function initEvent(){
        //新增账号事件
        $("#addAcc").click(function(event) {
            //如果渠道ID不存在是不能新增的
            var chnId = $("#chnId").val();
            if(!chnId){
                UIUtils.alertWarning("请确定拖车渠道信息存在后在操作！");
                return; //验证不通过，不执行以下代码
            }
            var id = "";
            addAcc(id);
        });
    }

    //存在一个启用状态的 取消掉新增按钮
  function displayInsert() {
        $("#addAcc").css("display","none");
        // $("#addAcc").attr('disabled','disabled');
    }

    //初始化列表
	function initGrid(){
	    //查询该拖车渠道下的账号
        var chnId = $("#chnId").val();
		$("#ligergrid_bankacc").ligerGrid({
			url:'<%=path%>/ass/assChnBankAcc/initList.do?channelId='+chnId,
			method:'get',
			//parms:getSearchParams(),
			columns:[
                { display: '账户名', name: 'accNm', width: 150, enabledSort:true},
				{ display: '开户银行', name: 'bkNm', width: 150, enabledSort:true,},
				{ display: '分行支行', name: 'accOrgNm', width: 170, enabledSort:true,},
                { display: '开户行行号', name: 'bkNo', width: 150, enabledSort:true,},

                { display: '银行账号', name: 'accNo', width: 150, enabledSort:true},
                { display: '账户类型', name: 'accTypCdNm', width: 150, enabledSort:true},
				{ display: '是否启用', name: 'isValid', width: 140, enabledSort:true,
                    render:function (rowdata, rowindex, value){
                        //存在一个启用的的 新增不可用
                        if (value == "1") {
                            displayInsert();
                        }
                        return (value == "1")?"启用中":"禁用";
                    }
                },
				// getGridOperColumnContent()//操作列
			],
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton:false,
			width:'100%',
			height:'100%',
			heightDiff:-2,
			checkbox:true,//列表是否有选择框
			rownumbers:true//列表是否有行号
		});
		grid = liger.get("ligergrid_bankacc");
		grid.setHeight(100);
		grid.options.isSingleCheck = false;//列表是否为单选
	}



</script>
</body>
</html>